package edu.pku.sei.act.codegen.getinfor;

import edu.pku.sei.act.model.mote.Data;
import edu.pku.sei.act.model.mote.LIP;
import edu.pku.sei.act.model.mote.Mote;
import edu.pku.sei.act.model.mote.Radio;
import edu.pku.sei.act.model.mote.SimpleDevice;
import edu.pku.sei.act.model.mote.Timer;
import edu.pku.sei.act.mote.myenum.StatusEnum;

public class MoteForCode {
	private Data data;
	private Radio radio;
	private Timer timer;
	private SimpleDevice simpleDevice;
	public LIP Lip;
	private String name;
	private StatusEnum status;
	
	
	
	public MoteForCode(Mote mote){
		this.data = mote.getData();
		this.radio = mote.getRadio();
		this.timer = mote.getTimer();
		this.simpleDevice = mote.getSimplerDevice();
		this.Lip = mote.getLIP();
		this.name = mote.getName();
		this.status = mote.getStatus();
	}
	
	public DataForCode getData(){
		return new DataForCode(this.data);
	}
	public boolean getRadio(){
		if(this.radio==null){
			return false;
		}
		RadioForCode r= new RadioForCode(this.radio);
		return r.getRadio();
	}
	public boolean getTimer(){
		if(this.timer==null){
			return false;
		}
		TimerForCode t= new TimerForCode(this.timer);
		return t.getTimer();
	}
	public boolean getSimpleDevice(){
		if(this.simpleDevice==null){
			return false;
		}
		SimpleDeviceForCode s = new SimpleDeviceForCode(this.simpleDevice);
		return s.getSimpleDevice();
	}
	public boolean getLIP(){
		if(this.Lip==null){
			return false;
		}
		LIPForCode l = new LIPForCode(this.Lip);
		return l.getLIP();
	}
	
	public String getName(){
		return this.name;
	}
	public String getStatus(){
		if (this.status == StatusEnum.ON){
			return "Definitions.ON";
		}else{
			return "Definitions.OFF";
		}
	}

}
